/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/misc/stringutils.h,v 1.4 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __STRINGUTILS_H_

// make sure everything is compiled with '_MT' defined.
// otherwise this will not link with code that has any of the mfc
// headers included.
//    without _MT this code compiles to non multithreaded templates,
//    with it compiles to templates with threading support.

#include <tchar.h>

#include <string>
#include <vector>
#include <map>

#include "vectorutils.h"

typedef std::vector<std::string> StringList;
typedef std::map<int,std::string> IntegerStringMap;

std::string ToString(TCHAR* tbuf);
std::wstring ToWString(TCHAR* tbuf);
std::string ToString(char* buf);
std::wstring ToWString(char* buf);
std::string ToString(const std::wstring& wstr);
std::wstring ToWString(const std::string& str);

void chomp(std::string& str);
void chomp(char *str);
bool SplitString(const std::string& str, StringList& strlist, bool bWithEscape= true);
std::string JoinStringList(const StringList& strlist, const std::string& sep);

std::string stringformat(char *fmt, ...);

int stringicompare(const std::string& a, const std::string& b);
std::string tolower(const std::string& str);

#define stringptr(v)  (&(v)[0])

std::string hexdump(const ByteVector& buf, int nDumpUnitSize=1);
std::string hexdump(const BYTE *buf, int nLength, int nDumpUnitSize=1);
std::string hexdump(DWORD dwOffset, const BYTE *buf, int nLength, int nDumpUnitSize=1, int nMaxUnitsPerLine=16);

#define __STRINGUTILS_H_
#endif
